
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>使用docker构建gitbook服务器 · Dr. Zhou's HOME</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        <meta name="author" content="Zhou Wei">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism-coy.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-advanced-emoji/emojify.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-ace/ace.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-katex/katex.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-sectionx/sectionx.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-codeblock-filename/block.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-local-video/video-js.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-image-captions/image-captions.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="atom.html" />
    
    
    <link rel="prev" href="script.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://weizhou.coding.me/weizhou/intro/" target="_blank" class="custom-link">周炜主页</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    学术研究
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../lecture/lecture.html">
            
                <a href="../../lecture/lecture.html">
            
                    
                    教学课程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../lecture/java/java.html">
            
                <a href="../../lecture/java/java.html">
            
                    
                    Java程序设计
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../../lecture/java/javaCode.html">
            
                <a href="../../lecture/java/javaCode.html">
            
                    
                    课件代码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../lecture/jsp/jsp.html">
            
                <a href="../../lecture/jsp/jsp.html">
            
                    
                    JSP开发技术
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../../lecture/jsp/jspCode.html">
            
                <a href="../../lecture/jsp/jspCode.html">
            
                    
                    课件代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="../../lecture/jsp/videos.html">
            
                <a href="../../lecture/jsp/videos.html">
            
                    
                    课程视频
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../lecture/ssh/ssh.html">
            
                <a href="../../lecture/ssh/ssh.html">
            
                    
                    Java Web框架开发技术
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.3.1" data-path="../../lecture/ssh/sshCode.html">
            
                <a href="../../lecture/ssh/sshCode.html">
            
                    
                    课件代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.2" data-path="../../lecture/ssh/videos.html">
            
                <a href="../../lecture/ssh/videos.html">
            
                    
                    课程视频
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.3" data-path="../../lecture/ssh/sshHomework.html">
            
                <a href="../../lecture/ssh/sshHomework.html">
            
                    
                    作业及测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.4" data-path="../../lecture/ssh/maven/mavenPPT.html">
            
                <a href="../../lecture/ssh/maven/mavenPPT.html">
            
                    
                    Maven简介
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../programming/programmingNote.html">
            
                <a href="../../programming/programmingNote.html">
            
                    
                    软件开发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../programming/develop/developNote.html">
            
                <a href="../../programming/develop/developNote.html">
            
                    
                    开发总结
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" >
            
                <span>
            
                    
                    Struts2
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.2.1" data-path="../../programming/struts/strutsNote.html">
            
                <a href="../../programming/struts/strutsNote.html">
            
                    
                    笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.2" data-path="../../programming/struts/strutsBug.html">
            
                <a href="../../programming/struts/strutsBug.html">
            
                    
                    坑
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.3" >
            
                <span>
            
                    
                    springMVC
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1" data-path="../../programming/springmvc/springmvcNote.html">
            
                <a href="../../programming/springmvc/springmvcNote.html">
            
                    
                    笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2" data-path="../../programming/springmvc/springmvcBug.html">
            
                <a href="../../programming/springmvc/springmvcBug.html">
            
                    
                    坑
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.4" >
            
                <span>
            
                    
                    Spring
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.4.1" data-path="../../programming/spring/springNote.html">
            
                <a href="../../programming/spring/springNote.html">
            
                    
                    笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.2" data-path="../../programming/spring/springBug.html">
            
                <a href="../../programming/spring/springBug.html">
            
                    
                    坑
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.5" >
            
                <span>
            
                    
                    Hibernate
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.5.1" data-path="../../programming/hibernate/hibernateNote.html">
            
                <a href="../../programming/hibernate/hibernateNote.html">
            
                    
                    笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.2" data-path="../../programming/hibernate/hibernateBug.html">
            
                <a href="../../programming/hibernate/hibernateBug.html">
            
                    
                    坑
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.6" >
            
                <span>
            
                    
                    weex
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.6.1" >
            
                <span>
            
                    
                    笔记
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6.2" data-path="../../programming/weex/problems.html">
            
                <a href="../../programming/weex/problems.html">
            
                    
                    坑
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.7" >
            
                <span>
            
                    
                    前端技术
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.7.1" data-path="../../programming/web/webNote.html">
            
                <a href="../../programming/web/webNote.html">
            
                    
                    笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7.2" data-path="../../programming/web/webBug.html">
            
                <a href="../../programming/web/webBug.html">
            
                    
                    坑
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.8" >
            
                <span>
            
                    
                    持续集成CI
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.8.1" data-path="../../programming/jenkins/jenkinsNote.html">
            
                <a href="../../programming/jenkins/jenkinsNote.html">
            
                    
                    Jenkins
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.9" >
            
                <span>
            
                    
                    运维
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.9.1" data-path="../../programming/devops/aws.html">
            
                <a href="../../programming/devops/aws.html">
            
                    
                    AWS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9.2" data-path="../../programming/devops/dockerTomcat.html">
            
                <a href="../../programming/devops/dockerTomcat.html">
            
                    
                    基于docker运行Tomcat/MySql
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9.3" data-path="../../programming/devops/dockerJenkins.html">
            
                <a href="../../programming/devops/dockerJenkins.html">
            
                    
                    基于docker运行Jenkins
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9.4" data-path="../../programming/devops/aliyun.html">
            
                <a href="../../programming/devops/aliyun.html">
            
                    
                    阿里云构建服务器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.10" >
            
                <span>
            
                    
                    Tools
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.10.1" data-path="../../programming/eclipse/eclipseNote.html">
            
                <a href="../../programming/eclipse/eclipseNote.html">
            
                    
                    Eclipse
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10.2" data-path="../../programming/idea/ideaNote.html">
            
                <a href="../../programming/idea/ideaNote.html">
            
                    
                    IDEA
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10.3" data-path="../../programming/vim/vimNote.html">
            
                <a href="../../programming/vim/vimNote.html">
            
                    
                    vim
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.11" >
            
                <span>
            
                    
                    项目分析
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.11.1" >
            
                <span>
            
                    
                    电子商场
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.11.1.1" data-path="../../programming/projSrc/wemall/basics.html">
            
                <a href="../../programming/projSrc/wemall/basics.html">
            
                    
                    基础功能
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.12" >
            
                <span>
            
                    
                    Scrapy
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.12.1" data-path="../../programming/scrapy/scrapyNote.html">
            
                <a href="../../programming/scrapy/scrapyNote.html">
            
                    
                    Note
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    学生讲座
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../stutalks/worldIntro/worldIntroPPT.html">
            
                <a href="../../stutalks/worldIntro/worldIntroPPT.html">
            
                    
                    我对三观的一些思考
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    我的解决方案
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../dpt/ref.html">
            
                <a href="../dpt/ref.html">
            
                    
                    DPT-S1解决方案
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1.1" data-path="../dpt/webdav.html">
            
                <a href="../dpt/webdav.html">
            
                    
                    WebDav
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.2" data-path="../dpt/display.html">
            
                <a href="../dpt/display.html">
            
                    
                    Dpt当显示器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.3" data-path="../dpt/root.html">
            
                <a href="../dpt/root.html">
            
                    
                    破解
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="gitbookReadme.html">
            
                <a href="gitbookReadme.html">
            
                    
                    gitBook解决方案
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.2.1" data-path="exp.html">
            
                <a href="exp.html">
            
                    
                    gitbook经验
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.2" data-path="error.html">
            
                <a href="error.html">
            
                    
                    gitBook坑
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.3" data-path="script.html">
            
                <a href="script.html">
            
                    
                    gitBook脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.2.4" data-path="awsDocker.html">
            
                <a href="awsDocker.html">
            
                    
                    使用docker构建gitbook服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.5" data-path="atom.html">
            
                <a href="atom.html">
            
                    
                    markdown编辑器Atom
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.6" data-path="ieee.html">
            
                <a href="ieee.html">
            
                    
                    使用markdown写IEEE论文
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >使用docker构建gitbook服务器</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x4F7F;&#x7528;docker&#x5B89;&#x88C5;gitbook&#x670D;&#x52A1;&#x5668;&#xFF0C;&#x53EF;&#x4EE5;&#x5FEB;&#x901F;&#x642D;&#x5EFA;gitbook&#x7F16;&#x8BD1;&#x73AF;&#x5883;&#xFF0C;&#x514D;&#x53BB;&#x7E41;&#x7410;&#x7684;&#x5B89;&#x88C5;&#x6B65;&#x9AA4;"><a name="&#x4F7F;&#x7528;docker&#x5B89;&#x88C5;gitbook&#x670D;&#x52A1;&#x5668;&#xFF0C;&#x53EF;&#x4EE5;&#x5FEB;&#x901F;&#x642D;&#x5EFA;gitbook&#x7F16;&#x8BD1;&#x73AF;&#x5883;&#xFF0C;&#x514D;&#x53BB;&#x7E41;&#x7410;&#x7684;&#x5B89;&#x88C5;&#x6B65;&#x9AA4;" class="plugin-anchor" href="#&#x4F7F;&#x7528;docker&#x5B89;&#x88C5;gitbook&#x670D;&#x52A1;&#x5668;&#xFF0C;&#x53EF;&#x4EE5;&#x5FEB;&#x901F;&#x642D;&#x5EFA;gitbook&#x7F16;&#x8BD1;&#x73AF;&#x5883;&#xFF0C;&#x514D;&#x53BB;&#x7E41;&#x7410;&#x7684;&#x5B89;&#x88C5;&#x6B65;&#x9AA4;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F7F;&#x7528;docker&#x5B89;&#x88C5;gitbook&#x670D;&#x52A1;&#x5668;&#xFF0C;&#x53EF;&#x4EE5;&#x5FEB;&#x901F;&#x642D;&#x5EFA;gitbook&#x7F16;&#x8BD1;&#x73AF;&#x5883;&#xFF0C;&#x514D;&#x53BB;&#x7E41;&#x7410;&#x7684;&#x5B89;&#x88C5;&#x6B65;&#x9AA4;</h2>
<h1 id="&#x4F7F;&#x7528;docker&#x5728;ubuntu&#x4E0A;&#x8FD0;&#x884C;gitbook">1. &#x4F7F;&#x7528;docker&#x5728;Ubuntu&#x4E0A;&#x8FD0;&#x884C;gitbook</h1>
<p>&#x8BF7;&#x6309;&#x7167;&#x4EE5;&#x4E0B;&#x6B65;&#x9AA4;&#x6267;&#x884C;&#xFF1A;</p>
<pre class="language-"><code>#&#x5B89;&#x88C5;docker
sudo apt-get update
sudo apt-get install -y curl \
    linux-image-extra-$(uname -r) \
    linux-image-extra-virtual
sudo apt-get install apt-transport-https \
                       ca-certificates
curl -fsSL https://yum.dockerproject.org/gpg | sudo apt-key add -
apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D
sudo add-apt-repository \
       &quot;deb https://apt.dockerproject.org/repo/ \
       ubuntu-$(lsb_release -cs) \
       main&quot;
sudo apt-get update
sudo apt-get -y install docker-engine
# &#x83B7;&#x53D6;docker&#x6620;&#x50CF;&#x5E76;&#x8FD0;&#x884C;
sudo docker pull weizhou/gitbookserver
sudo docker run -it weizhou/gitbookserver
# clone&#x81EA;&#x5DF1;&#x7684;gitbook&#x9879;&#x76EE;
cd ~
git clone your_git_repository_url
cd your_git_repository_dir
# &#x4F7F;&#x7528;gitbook&#x7F16;&#x8BD1;
gitbook build
gitbook install #&#x7B49;&#x5F85;&#x5B89;&#x88C5;gitbook&#x63D2;&#x4EF6;
gitbook build #&#x91CD;&#x65B0;&#x7F16;&#x8BD1;
# &#x5C06;&#x7F16;&#x8BD1;&#x597D;&#x7684;&#x6587;&#x4EF6;&#x4E0A;&#x4F20;&#x5230;git&#x670D;&#x52A1;&#x5668;
git push
exit
# &#x4FDD;&#x5B58;&#x6210;&#x65B0;&#x7684;docker&#x6620;&#x50CF;&#x4EE5;&#x5907;&#x4EE5;&#x540E;&#x4F7F;&#x7528;
sudo docker ps -q -l #&#x67E5;&#x770B;&#x5BB9;&#x5668;id
sudo docker commit &#x5BB9;&#x5668;id&#x524D;4&#x4F4D; whateverYourname/imageName
# &#x4EE5;&#x540E;&#x4F7F;&#x7528;&#x53EA;&#x8981;&#x8FD0;&#x884C;&#x5373;&#x53EF;:
sudo docker run -it whateverYourname/imageName
</code></pre><ul>
<li>&#x955C;&#x50CF;weizhou/gitbookserver&#x4E2D;&#x7684;~/weizhougitbooks/weizhou&#x4E2D;&#x4E3A;&#x672C;&#x7F51;&#x7AD9;&#x7684;&#x5B9E;&#x4F8B;&#x4EE3;&#x7801;&#xFF0C;&#x4EC5;&#x4F9B;&#x53C2;&#x8003;&#xFF0C;&#x8BF7;&#x52FF;&#x4F20;&#x64AD;&#x3002;&#x6216;&#x8005;&#x53EF;&#x4EE5;&#x5C06;&#x539F;&#x6765;&#x7684;weizhou&#x9879;&#x76EE;&#x4E2D;&#x7684;orign&#x6539;&#x6210;&#x81EA;&#x5DF1;&#x7684;git&#x5730;&#x5740;&#xFF0C;&#x518D;&#x4F7F;&#x7528;gitbook&#x7F16;&#x8BD1;&#xFF08;&#x672A;&#x6D4B;&#x8BD5;)</li>
<li>&#x7531;&#x4E8E;&#x65F6;&#x95F4;&#x6709;&#x9650;&#xFF0C;&#x5BF9;docker&#x7406;&#x89E3;&#x6709;&#x9650;&#xFF0C;&#x6CA1;&#x6709;&#x4F7F;&#x7528;dockerfile&#x6784;&#x5EFA;&#x5F71;&#x54CD;&#xFF0C;&#x5982;&#x6709;&#x4F7F;&#x7528;dockererfile&#x6784;&#x5EFA;&#x597D;&#x7684;&#x652F;&#x6301;&#x4E2D;&#x6587;&#x5206;&#x8BCD;&#x7B49;&#x63D2;&#x4EF6;&#x7684;gitbook&#x7F16;&#x8BD1;&#x73AF;&#x5883;&#x7684;docker&#xFF0C;&#x8BF7;&#x544A;&#x77E5;&#xFF0C;&#x8C22;&#x8C22;~</li>
</ul>
<h1 id="centos&#x5B89;&#x88C5;docker">2. Centos&#x5B89;&#x88C5;docker</h1>
<pre class="language-"><code>sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo yum -y install docker-io
sudo server docker start
</code></pre><h1 id="aws&#x5B89;&#x88C5;docker">3. AWS&#x5B89;&#x88C5;docker</h1>
<p>&#x4EE5;&#x4E0B;&#x4E3A;&#x6211;&#x5728;Amazon AWS&#x4E0A;&#x6784;&#x5EFA;docker&#x6620;&#x50CF;&#x7684;&#x539F;&#x59CB;&#x6B65;&#x9AA4;&#xFF0C;&#x4F9B;&#x53C2;&#x8003;&#xFF1A;</p>
<h2 id="&#x5B89;&#x88C5;docker">3.1. &#x5B89;&#x88C5;docker</h2>
<pre class="language-"><code>sudo apt-get update
sudo apt-get install curl \
    linux-image-extra-$(uname -r) \
    linux-image-extra-virtual
sudo apt-get install apt-transport-https \
                       ca-certificates
curl -fsSL https://yum.dockerproject.org/gpg | sudo apt-key add -
apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D
sudo add-apt-repository \
       &quot;deb https://apt.dockerproject.org/repo/ \
       ubuntu-$(lsb_release -cs) \
       main&quot;
sudo apt-get update
sudo apt-get -y install docker-engine
apt-cache madison docker-engine
sudo docker run hello-world
</code></pre><h2 id="&#x5B89;&#x88C5;gitnodejsgitbook">3.2. &#x5B89;&#x88C5;git,nodejs,gitbook</h2>
<pre class="language-"><code>docker run --name gitbookServer1 -it ubuntu:14.04
cd ~

sudo apt-get install -y git
git config --global user.email &quot;toweizhou@gmail.com&quot;

sudo apt-get update
sudo apt-get install -y wget
sudo apt-get update
sudo apt-get install xz-utils
wget https://nodejs.org/dist/v6.9.4/node-v6.9.4-linux-x64.tar.xz
xz -d node-v6.9.4-linux-x64.tar.xz
tar -xvf node-v6.9.4-linux-x64.tar
ln -s ~/node-v6.9.4-linux-x64/bin/node /usr/local/bin/node
ln -s ~/node-v6.9.4-linux-x64/bin/npm /usr/local/bin/npm

npm install -g gitbook-cli
ln -s ~/node-v6.9.4-linux-x64/bin/gitbook /usr/local/bin/gitbook
gitbook -V

exit

sudo docker ps -l -q

&#x6CE8;&#x518C;github&#x8D26;&#x53F7;&#x5E76;&#x4F7F;&#x7528;sudo docker login&#x6D4B;&#x8BD5;
sudo docker commit 897 weizhou/gitbookserver1
</code></pre><h2 id="&#x83B7;&#x53D6;gitbook&#x9879;&#x76EE;&#x5E76;&#x8FDB;&#x884C;&#x7F16;&#x8BD1;">3.3. &#x83B7;&#x53D6;gitbook&#x9879;&#x76EE;&#x5E76;&#x8FDB;&#x884C;&#x7F16;&#x8BD1;</h2>
<pre class="language-"><code>sudo docker images
sudo docker run -it weizhou/gitbookserver1 /bin/bash
mkdir weizhougitbooks
cd weizhougitbooks
git clone https://git.coding.net/weizhou/weizhou.git
cd weizhou
git branch coding-pages
git branch --set-upstream-to=origin/coding-pages coding-pages
git pull origin coding-pages
./gbbuild.sh
#&#x63D0;&#x793A;&#x9700;&#x8981;&#x5B89;&#x88C5;&#x7684;&#x63D2;&#x4EF6;&#x5982;&#x4E0B;&#xFF1A;
search-jieba, prism, advanced-emoji, include-codeblock, ace, emphasize, katex, anchors, mermaid, tbfed-pagefooter, sectionx, expandable-chapters, codeblock-filename, local-video, splitter, duoshuo, baidu, donate, anchors, anchor-navigation-ex, image-captions
#&#x4F7F;&#x7528;npm&#x5168;&#x5C40;&#x5B89;&#x88C5;
sudo apt-get install -y python
sudo apt-get install -y make
sudo apt-get install -y g++
npm config set unsafe-perm true
sudo npm install -g nodejieba
gitbook install

# &#x4FEE;&#x6539;git&#x4ED3;&#x5E93;&#x5730;&#x5740;&#x5E76;&#x914D;&#x7F6E;ssh&#x514D;&#x5BC6;&#x767B;&#x5F55;
cd weizhougitbooks/weizhou/
git remote remove origin
git remote add origin git@git.coding.net:weizhou/weizhou.git
git branch --set-upstream-to=origin/coding-pages coding-pages

ssh-keygen -t rsa
sudo apt-get install -y vim
sudo vim /root/.ssh/id_rsa.pub
&#x590D;&#x5236;&#x6DFB;&#x52A0;&#x5230;coding&#x7684;&#x516C;&#x94A5;&#x4E2D;
</code></pre><ul>
<li>AWS&#x4E0A;gitbook install&#x65F6;&#x51FA;&#x73B0;&#x5185;&#x5B58;&#x4E0D;&#x591F;&#xFF0C;&#x6000;&#x7591;&#x662F;aws&#x514D;&#x8D39;&#x7684;&#x5185;&#x5B58;&#x5C0F;&#xFF0C;&#x89E3;&#x51B3;&#x65B9;&#x6CD5;&#x662F;&#x5C06;docker&#x6620;&#x50CF;&#x4E0A;&#x4F20;&#x5230;docker hub&#x5728;&#x81EA;&#x5DF1;&#x7684;ubuntu&#x4E0A;&#x6267;&#x884C;&#x5B8C;gitbook install&#x518D;&#x4F20;&#x56DE;aws</li>
</ul>
<h2 id="crontab&#x8BA1;&#x5212;&#x4EFB;&#x52A1;">3.4. crontab&#x8BA1;&#x5212;&#x4EFB;&#x52A1;</h2>
<p>crontab&#x4E3A;ubuntu&#x7684;&#x8BA1;&#x5212;&#x4EFB;&#x52A1;&#xFF0C;&#x6267;&#x884C;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#xFF1A;</p>
<pre class="language-"><code>crontab -e
*/2 * * * * sudo docker run weizhou/gitbookserver1 /root/weizhougitbooks/weizhou/gbbuild.sh
sudo service cron restart
</code></pre><h2 id="&#x4F7F;&#x7528;jenkins">3.5. &#x4F7F;&#x7528;Jenkins</h2>
<p>aws&#x8FD0;&#x884C;(&#x975E;docker&#x5BB9;&#x5668;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;docker&#x5BB9;&#x5668;&#x4E2D;&#x4F7F;&#x7528;Jenkins&#xFF0C;&#x4F46;&#x4F1A;&#x6D89;&#x53CA;&#x5230;&#x5BB9;&#x5668;&#x4E4B;&#x95F4;&#x7684;&#x547D;&#x4EE4;&#x8C03;&#x7528;)</p>
<pre class="language-"><code>wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c &apos;echo deb http://pkg.jenkins.io/debian-stable binary/ &gt; /etc/apt/sources.list.d/jenkins.list&apos;
sudo apt-get update
sudo apt-get install jenkins
# &#x914D;&#x7F6E;jenkins
poll PCM: H/5 * * * *
Execute shell command: /home/ubuntu/gitbookserver.sh
sudo /etc/sudoers
&#x6DFB;&#x52A0;&#x4EE5;&#x4E0B;&#x4EE3;&#x7801;&#xFF1A;
%jenkins ALL=NOPASSWD: ALL
</code></pre><ul>
<li>jenkins&#x8BBE;&#x7F6E;     Additional Behaviours
Polling ignores commits with certain messages&#x4EE5;&#x53CA;Polling ignores commits in certain paths&#x5BF9;&#x7279;&#x5B9A;&#x63D0;&#x4EA4;&#x4EE5;&#x53CA;&#x7279;&#x5B9A;&#x6587;&#x4EF6;&#x63D0;&#x4EA4;&#x8FC7;&#x6EE4;&#xFF0C;&#x4EE5;&#x514D;gitbook&#x4E2D;&#x6587;&#x5206;&#x8BCD;&#x63D2;&#x4EF6;&#x53CA;&#x65F6;&#x5185;&#x5BB9;&#x4E0D;&#x53D8;&#x4E5F;&#x66F4;&#x65B0;&#x5BFC;&#x81F4;git&#x66F4;&#x65B0;
<img src="jenkins.PNG" alt=""></li>
<li>/home/ubuntu/gitbookserver.sh&#x5185;&#x5BB9;&#xFF1A;<pre class="language-"><code>#!/bin/bash
sudo docker run --rm weizhou/gitbookserver1:ssh /root/weizhougitbooks/weizhou/gbbuild.sh
#&#x5220;&#x9664;&#x6240;&#x6709;&#x5BB9;&#x5668;
#sudo docker rm $(sudo docker ps -a -q)
</code></pre><h2 id="&#x914D;&#x5408;nodeppt&#x4F7F;&#x7528;">3.6. &#x914D;&#x5408;nodePPT&#x4F7F;&#x7528;</h2>
aws docker&#x4E2D;&#x6267;&#x884C;<pre class="language-"><code>npm install -g nodeppt
ln -s ~/node-v6.9.4-linux-x64/bin/nodeppt /usr/local/bin/nodeppt
</code></pre></li>
<li>&#x53EF;&#x4EE5;&#x4F7F;&#x7528;iframe&#x5728;gitbook&#x9875;&#x9762;&#x5D4C;&#x5165;nodePPT&#x751F;&#x6210;&#x7684;htm&#x6587;&#x4EF6;(nodePPT&#x9ED8;&#x8BA4;&#x751F;&#x6210;htm&#xFF0C;gitbook&#x9ED8;&#x8BA4;&#x751F;&#x6210;html&#xFF0C;&#x6B63;&#x597D;&#x4E0D;&#x51B2;&#x7A81;)</li>
<li>&#x7531;&#x4E8E;gitbook&#x7684;summary.md&#x4E2D;&#x53EA;&#x80FD;&#x653E;&#x5165;md&#x6587;&#x4EF6;&#xFF0C;&#x4E14;&#x65E0;&#x6CD5;&#x4FEE;&#x6539;&#x81EA;&#x52A8;&#x751F;&#x6210;&#x7684;&#x76EE;&#x5F55;&#x8D85;&#x94FE;&#x63A5;&#xFF0C;&#x56E0;&#x6B64;summary.md&#x4E2D;&#x8FDE;&#x63A5;&#x7684;&#x662F;xxxPPT.md&#xFF0C;&#x8FD9;&#x4E2A;&#x6587;&#x4EF6;&#x91CC;&#x9762;&#x663E;&#x793A;&#x771F;&#x6B63;&#x7684;md&#x751F;&#x6210;&#x7684;html&#x7684;&#x5730;&#x5740;</li>
<li>&#x7F16;&#x8BD1;&#x65F6;&#x5148;&#x6267;&#x884C;nodeppt&#x751F;&#x6210;html&#xFF0C;&#x5728;&#x6267;&#x884C;gitbook&#x751F;&#x6210;&#x8F93;&#x51FA;&#x9875;&#x9762;&#xFF0C;nodeppt&#x751F;&#x6210;&#x7684;html&#x5185;&#x5BB9;&#x4F1A;&#x81EA;&#x52A8;&#x88AB;&#x590D;&#x5236;&#x5230;&#x8F93;&#x51FA;&#x9875;&#x9762;</li>
<li>&#x6B64;&#x65F6;gbbuild.sh&#x6587;&#x4EF6;&#x5185;&#x5BB9;&#x4E3A;&#xFF1A;<pre class="language-"><code>#!/bin/bash
cd ~/weizhougitbooks/weizhou
git pull
nodeppt generate stutalks/worldIntro/worldIntro.md stutalks/worldIntro -a
cd ..
gitbook build weizhou weizhou/intro
cd weizhou
git add -A
git commit -m &apos;gitbook build finished&apos;
git push
</code></pre></li>
</ul>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; &#x5468;&#x709C; 2016-2017 &#x5982;&#x9700;&#x8F6C;&#x8F7D;&#x8BF7;&#x6807;&#x660E;&#x51FA;&#x5904; all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2018-04-02 13:28:03
</span></footer><div id="anchors-navbar"><i class="fa fa-anchor"></i><ul><p><a href="#"></a></p><li><a href="#&#x4F7F;&#x7528;docker&#x5728;ubuntu&#x4E0A;&#x8FD0;&#x884C;gitbook">1. &#x4F7F;&#x7528;docker&#x5728;Ubuntu&#x4E0A;&#x8FD0;&#x884C;gitbook</a></li><li><a href="#centos&#x5B89;&#x88C5;docker">2. Centos&#x5B89;&#x88C5;docker</a></li><li><a href="#aws&#x5B89;&#x88C5;docker">3. AWS&#x5B89;&#x88C5;docker</a></li><ul><li><a href="#&#x5B89;&#x88C5;docker">3.1. &#x5B89;&#x88C5;docker</a></li><li><a href="#&#x5B89;&#x88C5;gitnodejsgitbook">3.2. &#x5B89;&#x88C5;git,nodejs,gitbook</a></li><li><a href="#&#x83B7;&#x53D6;gitbook&#x9879;&#x76EE;&#x5E76;&#x8FDB;&#x884C;&#x7F16;&#x8BD1;">3.3. &#x83B7;&#x53D6;gitbook&#x9879;&#x76EE;&#x5E76;&#x8FDB;&#x884C;&#x7F16;&#x8BD1;</a></li><li><a href="#crontab&#x8BA1;&#x5212;&#x4EFB;&#x52A1;">3.4. crontab&#x8BA1;&#x5212;&#x4EFB;&#x52A1;</a></li><li><a href="#&#x4F7F;&#x7528;jenkins">3.5. &#x4F7F;&#x7528;Jenkins</a></li><li><a href="#&#x914D;&#x5408;nodeppt&#x4F7F;&#x7528;">3.6. &#x914D;&#x5408;nodePPT&#x4F7F;&#x7528;</a></li></ul></ul></div><a href="#&#x4F7F;&#x7528;docker&#x5728;ubuntu&#x4E0A;&#x8FD0;&#x884C;gitbook" id="goTop"><i class="fa fa-arrow-up"></i></a>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="script.html" class="navigation navigation-prev " aria-label="Previous page: gitBook脚本">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="atom.html" class="navigation navigation-next " aria-label="Next page: markdown编辑器Atom">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"使用docker构建gitbook服务器","level":"1.5.2.4","depth":3,"next":{"title":"markdown编辑器Atom","level":"1.5.2.5","depth":3,"path":"solution/gitbook/atom.md","ref":"solution/gitbook/atom.md","articles":[]},"previous":{"title":"gitBook脚本","level":"1.5.2.3","depth":3,"path":"solution/gitbook/script.md","ref":"solution/gitbook/script.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-lunr","search-jieba","-highlight","prism","advanced-emoji@0.1.5","include-codeblock","ace","emphasize","katex","anchors","mermaid","tbfed-pagefooter","sectionx","expandable-chapters","codeblock-filename","local-video","splitter","duoshuo","baidu","donate","anchors","anchor-navigation-ex","image-captions"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"search-jieba":{},"tbfed-pagefooter":{"copyright":"Copyright &copy 周炜 2016-2017 如需转载请标明出处","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"prism":{"css":["prismjs/themes/prism-coy.css"]},"emphasize":{},"ace":{},"github":{"url":"https://github.com/zhangjikai/gitbook-use"},"splitter":{},"search":{},"mermaid":{},"duoshuo":{"short_name":"weigitbooktest","theme":"default"},"donate":{"alipay":"http://weizhou.coding.me/weizhou/images/ZhouWeiAlipay.png","alipayText":"支付宝打赏","button":"赏","title":"","wechat":"http://weizhou.coding.me/weizhou/images/ZhouWeiWechatPay.jpg","wechatText":"微信打赏"},"katex":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sectionx":{},"anchor-navigation-ex":{"isRewritePageTitle":true},"codeblock-filename":{},"sitemap":{"hostname":"http://www.baidu.com"},"local-video":{},"baidu":{"token":"a3f08983487a96aa9943fa1394254a16"},"advanced-emoji":{"myConfigKey":"test"},"include-codeblock":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":true,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"expandable-chapters":{},"image-captions":{"caption":"Image _PAGE_LEVEL_._PAGE_IMAGE_NUMBER_ - _CAPTION_","variable_name":"_pictures"}},"theme":"default","author":"Zhou Wei","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"_pictures":[{"backlink":"lecture/ssh/sshHomework.html#fig1.2.3.3.1","level":"1.2.3.3","list_caption":"Figure: SpringTest项目图","alt":"SpringTest项目图","nro":1,"url":"assets/markdown-img-paste-20170412131653323.png","index":1,"caption_template":"Image _PAGE_LEVEL_._PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"SpringTest项目图","attributes":{},"skip":false,"key":"1.2.3.3.1"}]},"title":"Dr. Zhou's HOME","language":"zh-hans","links":{"sidebar":{"周炜主页":"http://weizhou.coding.me/weizhou/intro/"}},"gitbook":"3.2.2","description":"Dr. Zhou's HOME"},"file":{"path":"solution/gitbook/awsDocker.md","mtime":"2018-04-02T13:28:03.729Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2018-04-02T13:28:08.830Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-jieba/pouchdb.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-jieba/pouchdb.load.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-jieba/search-jieba.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-ace/ace/ace.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-ace/ace.js"></script>
        
    
        
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sectionx/sectionx.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-local-video/video.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-duoshuo/duoshuo.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-baidu/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

